package org.jetnuke.blocks;

import javax.servlet.http.HttpServletRequest;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IBlock;
import org.jetnuke.common.IBlockInfo;
import org.jetnuke.common.IUserInfo;
import org.jetnuke.dao.DataAccessDriver;

public class Last10Articles implements IBlock {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jetnuke.common.IBlock#serviceBlock(javax.servlet.http.HttpServletRequest,
	 *      org.apache.velocity.VelocityContext, org.jetnuke.common.IBlockInfo,
	 *      org.jetnuke.common.IUserInfo, org.jetnuke.common.IAdminInfo)
	 */
	public void serviceBlock(HttpServletRequest req, VelocityContext vc,
			IBlockInfo blockInfo, IUserInfo userInfo, IAdminInfo adminInfo)
			throws Exception {
		vc.put("stories", 
				DataAccessDriver.getInst().newStoriesDAO().selectOrderBySidDescLimit(10));
				//storiesPeer.doSelect(new Criteria()
				//.addDescendingOrderByColumn(storiesPeer.SID).setLimit(10)));

	}

}
